Correlating queries issued by applications with their source lines and analyzing applications for problem determination and where used analysis

ABSTRACT

Provided are techniques for invoking with a processor executing on a computer a source code parser to obtain source information that includes a first location of an Application Programming Interface (API) call and parameters of the API call in source code of a client application, where the parameters the API call do not include query text for a query that is to be used to access a database; examining a stack trace to determine a second location of the API call in the stack trace; and deriving the query of the API call and a third location of the query in the source code by identifying the query in the stack trace at the location of the API call in the stack trace.

BACKGROUND

1. Field

Embodiments of the invention relate to correlating queries issued byapplications with their source lines and analyzing applications forproblem determination and where used analysis.

2. Description of the Related Art

Relational DataBase Management System (RDBMS) software may use aStructured Query Language (SQL) interface. The SQL interface has evolvedinto a standard language for RDBMS software and has been adopted as suchby both the American National Standards Institute (ANSI) and theInternational Standards Organization (ISO).

An RDBMS uses relational techniques for storing and retrieving data in arelational database. Relational databases are computerized informationstorage and retrieval systems. Relational databases are organized intotables that consist of rows and columns of data. The rows may be calledtuples or records or rows. A database typically has many tables, andeach table typically has multiple rows and multiple columns.

Database applications (also referred to herein as “client applications”)in an enterprise implement business logic and interact with data storedin databases. Up to now, how the database applications interact with thedatabases remains in the hands of a database application developerresponsible for coding the database applications (i.e., to developdatabase source code). In a more rigorous environment, there are modelsthat describe both the data and the database applications. A logicalmodel may be produced that describes the data as the business sees thedata, while a physical model may be produced that describes the data asstored. Further, an application model may be produced that documents theinteraction between the database application and either the logicalmodel or the physical model. These models serve to describe how thedatabase application interacts with the data used by the business.Developers tasked with maintaining the database applications rely onthese models to understand how the database applications are impacted asthe database changes. Database administrators (DBAs) also rely on thesemodels to optimize the database based on how the data is being used.More often than not, such application models are either out of date orincomplete. This makes the task of maintaining database applicationsdifficult.

If a change to a database is required for some database applications,such as altering some of the database objects (e.g., tables and columns)or database schemas or adding new database objects or database schemaswithin the database, it becomes difficult to determine which databaseapplications are affected and to determine the cost of modifying thedatabase applications to use the changed or new database objects ordatabase schemas. Such roadblocks often lead to database tables thatreflect the need to minimize the impact to existing databaseapplications rather than to reflect the needs of the business. Suchdatabases become difficult to maintain and understand as the businessneeds evolve.

Thus, there is a need for a better way of gathering information aboutrunning database applications to make it easier for developers tounderstand how the database applications make use of the database andthe extent of changes to be made to the database applications to use adifferent database schema.

Today, database application developers and DBAs face numerous painpoints when trying to isolate poorly performing queries (e.g., SQLstatements) or trying to determine the queries being issued against thedatabase for audit purposes. Finding and making the correlation betweenthe queries and the related JAVA® source code (of a JAVA® application,which may also be referred to as a JAVA® database application) istedious and time-consuming (JAVA is a trademark of Sun Microsystems inthe United States, other countries, or both). Often the way tounderstand how the database application accesses the database is togather all the queries issued by the database application. It isespecially burdensome when DBAs see problematic queries issued againstthe database and have to get help to find the database application thatissued the problematic queries.

Correlating queries executed on the database to the actual lines of codetriggering the queries includes gathering and wading through stacktraces from database drivers and different data access componentsaccessed by the database application. The process is repeated every timeany problem occurs in the database application. The ability to correlatedepends on the underlying components to provide appropriate stack tracesand is a continuous burden on developers to add stack traces and keepthem correct.

The DBA is also limited in identifying what JAVA® classes were issuingthe queries due to the limited information found in the stack traces.Because the developers choose JAVA Database Connectivity (JDBC®) or aJDBC®-based framework, the DBA has limited tools to help the developerknow what database applications the queries are coming from (JDBC is atrademark of Sun Microsystems in the United States, other countries, orboth).

The correlation gets more complex with three-tier architectures and whenframeworks are used. A three tier architecture may be described asfurther refining a client-server architecture into three separatelayers: presentation, business logic, and data storage. The three tierarchitecture is different from a traditional two tier model in which thebusiness logic and presentation layers are combined into a client layer.Applications using frameworks, such as a HIBERNATE® framework (which isan Object Relational Mapping (ORM) framework for JAVA® applications) ora JAVA® Persistence API (JPA) framework, generate queries on the fly,and it is difficult for the developer to trace back a particular query(or set of queries) to the query language of the framework thatgenerated the query, even when the JAVA® source code is available(HIBERNATE is a trademark of Red Hat, Inc. Software Foundation in theUnited States, other countries, or both). When the JAVA® source code isnot available, it is even more difficult. Therefore, if an end user,developer, or DBA complains about a poorly performing query, it may be alarge effort to try and locate that query in the originating JAVA®source code.

In addition, there is no easy way to gain insight into which databaseobjects were referenced by which parts of a JAVA® application. Teammembers working on different parts of the database application do nothave a way to gain insight into what queries the other parts of thedatabase application would be issuing to the database. Developers do nothave information about all the queries issued by a certain JAVA® class.In addition, on the database side, schemas are continuously changing aspart of the database application development process. The inability togain insight into how much the change would impact the databaseapplication makes such changes risky. Developers and DBAs cannot easilywork together to understand the impact of such changes. Because of this,the complicated process of determining the impact of a change slows downdevelopment, resulting in delays for delivering a final product, orperhaps even resulting in the decision not to make changes because ofsuch delays.

Thus, there is need for understanding the relationship between queriesand their source code for both DBAs and developers alike.

BRIEF SUMMARY

Provided are a method, computer program product, and system for invokingwith a processor executing on a computer a source code parser to obtainsource information that includes a first location of an ApplicationProgramming Interface (API) call and parameters of the API call insource code of a client application, where the parameters of the APIcall do not include query text for a query that is to be used to accessa database; examining a stack trace to determine a second location ofthe API call in the stack trace; and deriving the query of the API calland a third location of the query in the source code by identifying thequery in the stack trace at the location of the API call in the stacktrace.

Provided are a method, computer program product, and system for setting,with a processor executing on a computer, one or more breakpoints insource code of a client application based on locations of ApplicationProgramming Interface (API) calls in the source code; and, while runningthe client application through a debugger, upon reaching each of the oneor more breakpoints, identifying one or more debugger rules associatedwith a query at a breakpoint; in response to determining that conditionsof the one or more debugger rules are satisfied, obtaining a stack tracebefore the query makes a call to a database; and deriving query text ofthe query and a location of the query in source code of the clientapplication.

Provided are a method, computer program product, and system forretrieving the correlator results and generating user interface viewsusing the correlator results, wherein the user interface views provideat least one of: a view showing the query in the database and the queryin the source code, a view showing database schemas and database objectsthat the query uses, a view showing queries per class, a view showingthe queries used by each database object in the database, a view showinghow queries are run, a view for exporting data, and a view showingperformance information of execution count and execution time for eachof the queries.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

Referring now to the drawings in which like reference numbers representcorresponding parts throughout:

FIG. 1 illustrates, in a block diagram, a computing environment inaccordance with certain embodiments of the invention.

FIG. 2 illustrates logic performed by a correlator using sourceinformation and a stack trace to gather data to understand how a clientapplication accesses a database in accordance with certain embodiments.

FIG. 3 illustrates logic performed by a correlator using a debugger togather data to understand how a client application accesses a databasein accordance with certain alternative embodiments.

FIG. 4 illustrates logic performed by an analyzer and a UI generator inaccordance with certain embodiments.

FIGS. 5A, 5B, 5C, and 5D illustrate a user interface view showinglinking to a query when using JDBC® in accordance with certainembodiments.

FIG. 6 illustrates a user interface view showing selection of a JAVA®tab in accordance with certain embodiments.

FIG. 7 illustrates a user interface view showing further details of alist of queries per JAVA® class in accordance with certain embodiments.

FIG. 8 illustrates a user interface view showing database schemas anddatabase objects that a query uses in accordance with certainembodiments.

FIG. 9 illustrates a user interface view showing queries used by eachdatabase object in accordance with certain embodiments.

FIGS. 10A, 10B, 10C, and 10D illustrate a user interface view showinghow queries may be run with a “Run SQL menu” in accordance with certainembodiments.

FIGS. 11A, 11B, 11C, and 11D illustrate a user interface view showingthe performance of a query with a “Launch Visual Explain” menu inaccordance with certain embodiments.

FIGS. 12A, 12B, 12C, and 12D illustrate a user interface view forexporting data in accordance with certain embodiments.

FIGS. 13A, 13B, 13C, and 13D provide a user interface view withperformance information in accordance with certain embodiments.

FIG. 14 illustrates a system architecture that may be used in accordancewith certain embodiments.

DETAILED DESCRIPTION

In the following description, reference is made to the accompanyingdrawings which form a part hereof and which illustrate severalembodiments of the invention. It is understood that other embodimentsmay be utilized and structural and operational changes may be madewithout departing from the scope of the invention.

FIG. 1 illustrates, in a block diagram, a computing environment inaccordance with certain embodiments of the invention. A computer 100includes a repository 160. The computer 100 includes a developmentenvironment 110 and one or more server applications 120. The developmentenvironment 110 is coupled to the repository 160. The developmentenvironment 110 includes one or more client applications 112, a sourcecode parser 114, a searchable index 116, and a User Interface (UI)generator 118. The source code parser 114 parses the source code of eachclient application 112 and stores locations of Application ProgrammingInterface (API) calls in the searchable index 116. Client applications112 use a set of known access techniques to issue queries against thedatabase 170. These access techniques, commonly referred to databaseaccess API calls or APIs, are well known in the programming community.For example, a well known set of database access API calls for JAVA®applications, known as JDBC® API calls, have a well defined set ofclasses and methods to gain access to data in the database 160. Thesource code parser 114 makes use of knowledge of the API calls to findthe locations within the source code of each client application 112where such API calls are used.

Although the client applications 112 and server applications 120 areshown at the same computer 100, the client applications 112 may executeat a different computer coupled to computer 100. In certain embodiments,client applications 112 are database applications. Each clientapplication 112 may be said to be implemented from source code in a highlevel programming language (e.g., the JAVA® programming language or theC++ programming language).

The development environment 110 includes a query parser 115. The queryparser 115 breaks up a query into individual parts (e.g., columns andtables) to gain understanding of database tables and columns referencedby the query.

The repository 160 that stores data of the client applications 112includes one or more databases 170. The database 170 also storescorrelator results 172 (generated by the correlator 130), analyzerresults 178 (generated by the analyzer 150), one or more database schema176, source information 180, one or more stack traces 182, one or moredatabase objects 186 (e.g., tables and columns) and debugger rules 190.A stack trace 182 may be generated by running a client application 182through the debugger 140 or using another tool that generates the stacktrace.

The development environment 110 includes a correlator 130 thatcorrelates queries issued by client applications 112 with their sourcelines in the source code. The correlator 130 analyzes the source code toidentify source information 180 (e.g., locations of API calls in thesource code that access the database) and stack traces 182 of executionof the source code to correlate queries issued by the API calls with thelocation of the API calls in the source code. The source information 180includes the API calls and the locations of the API calls in the sourcecode. In certain embodiments, the source information 180 includes, foreach API call, a file name, a line number, the API call, and parametersfor the API call. If a parameter is a full query, the source information180 also includes the query. If a parameter is a program expression thatwould result in a query during runtime, the source information 180 doesnot have the complete query. The stack trace 182 may be said to includestack information including the API call, parameters of the API call,and the application call path. An application call path details how theAPI is called within the client application 112. For example, if withina client application 112, function A calls function B, which then callsthe API, the stack trace 182 includes information about function A,function B, and the API call.

The development environment 110 also includes a debugger 140. Thedebugger 140 uses the source information 180 to generate breakpoints inthe source code and uses debugger rules 190 to determine at what pointafter a breakpoint to take a copy of the stack trace 182 while runningthe client application 112. A stack trace may be described as acollection of information that indicates where an invocation of an APIcall originates in the source code.

The development environment includes an analyzer 150. The analyzer 150analyzes the client application 112 for problem determination and whereused analysis (“where used” analysis may be described as referring to aprocess that determines where a database table or database column isbeing used in the client applications 112).

The repository 160 may comprise an array of storage devices, such asDirect Access Storage Devices (DASDs), Just a Bunch of Disks (JBOD),Redundant Array of Independent Disks (RAID), virtualization device, etc.

Embodiments analyze how queries access database objects 186 and deducethe relationship between the database objects 186 and source code, thusproviding insight into how different client applications make use of thedatabase objects.

There are different ways to gain insight into a running clientapplication 112. In certain embodiments, the client application 112 iswritten using database access API calls, and no changes are made to theexisting client application 112 to work with the correlator 130 and thedebugger 140. That is, embodiments describe techniques for handlingexisting client applications 112 without changing the source code of theclient applications 112 (e.g., without adding new API calls to thesource code). Certain embodiments of the correlator 130 and debugger 140focus on client applications 112 that use the JAVA® programminglanguage, but embodiments apply to any programming language (includingprocedural programming languages).

Merely to enhance understanding, an example will be provided to show howthe correlator 130 generates correlator results 172. Some developmentenvironments have built-in parsers for the source code.

For example, the source code parser 114 in the development environment110 outputs a searchable index 116 identifying where API calls to thedatabase 170 are used in the source code. The correlator 130 constructsa query to find the locations in the source code where the API calls tothe database 170 are used. For JDBC® applications, the correlator 130looks for the API calls listed in Set A in the searchable index 116 (andthese API calls may also be referred to as methods):

Set A

java.sql.Connection::prepareStatement

java.sql.Connection::prepareCall

java.sql.Connection::nativeSQL

java.sql.Statement::execute

java.sql.Statement.addBatch

java.sql.Statement::executeQuery

java.sql.Statement::executeUpdate

The API calls listed in Set A are the calls a JAVA® application may maketo issue queries against the database 170. In certain embodiments, bylocating the source code location where the API calls are made and byexamining the source lines, the correlator 130 is able to determine thequery calls made by the client application 112 to the database 170. Forexample, the correlator 130 might find the following source code, CodeA:

Code A

-   -   stmt=connection.prepareStatement(“SELECT FIRSTNME, LASTNAME from        EMPLOYEE”);

The correlator 130 may use a search function to locate Code A using thesearchable index 116 as something to do with the call tojava.sql.Connection::prepareStatement. With this information, thecorrelator 130 jumps directly to the line in the source code at whichthe API call is made, and the correlator 130 invokes the source codeparser 114 to parse Code A to obtain Query A issued by the clientapplication 112 at this line:

Query A

-   -   SELECT FIRSTNME, LASTNAME from EMPLOYEE

Query A selects data from the FIRSTNME and LASTNAME columns from anEMPLOYEE table. The correlator 130 has Query A issued by the clientapplication 112 and the source information 180 identifying the locationin the source code of the API call for Query A. In some embodiments, thecorrelator 130 is then able to identify that Query A is called from thelocation in the source code of the API call. The correlator 130 storescorrelator results 172 in the repository 160. The correlator resultsinclude the query, tables and columns used in the query, and thelocation in the source code where the query is used. In certainembodiments, the correlator 130 invokes the query parser 115 to parsethe query and to determine the tables and columns used in the query.That is, the correlator 130 may also invoke the query parser 115 toparse the query so as to understand the database objects 186 used by thequery. For Query A, the query parser 115 informs the correlator 130 thatQuery A uses columns FIRSTNME and LASTNAME from the table EMPLOYEE. Thecorrelator 130 then stores the source code location, including linenumber, the query, and that the query makes use of the FIRSTNME andLASTNAME columns into the repository 160 for further analysis.

In such cases, whenever there is a change request for the EMPLOYEEtable, the FIRSTNME column or the LASTNAME column, the repository 160may be queried to gather dependency information for the clientapplication 112 that makes use of the FIRSTNME and LASTNAME columns orthe table EMPLOYEE. The dependency information for a query identifiestables and columns used by the query. For the query to run properly, aparticular table and columns may be referenced, and so the query is saidto be dependent on the particular table and columns that the queryreferences. The dependency information from the repository 160 may beused to direct developers to the source code line that issues the query.The developer may then accurately assess the impact of the proposedchange to the client application 112.

Sometimes, the source code at the location of the API call may not haveenough information to enable the correlator 130 to derive the queryused. For example, the following is Source Line A:

Source Line A

-   -   ResultSet resultSet=statement.executeQuery(“SELECT ”+getColumns(        )+getTable( );

With Source Line A, the query statement is not available until theclient application 112 is run and the functions getColumns( ) andgetTable( ) are called to complete the query statement. The correlator130 cannot just use the source information 180 to identify the query.Therefore, an alternative is used to capture the query used by theclient application 112 when the client application 112 runs (i.e.,executes). The correlator 130 knows that the “executeQuery” API call islocated at line 85 of the source code (from the source information 180).In certain embodiments, by installing a wrapper around the JDBC®connection used to issue the query, correlator 130 may capture asnapshot of the stack trace as the client application 112 issues a callto the database 170. For example, the correlator 130 captures StackTrace A shown in the form of an Extensible Markup Language (XML)fragment:

Stack Trace A <prepareSql>SELECT DEPTNO, DEPTNAME, MGRNO, ADMRDEPT,LOCATION FROM DEPARTMENT</prepareSql>  <traceInfo>   <traceEntryclassFile=″StatementProxyHandler″   containingPkg=″com.ibm.pdq.runtime.internal.wrappers.db2″   fileName=″Unknown Source″ isNative=″false″ lineNo=″″    method=″executeQuery″/>   <traceEntryclassFile=″DepartmentJDBCSample″    containingPkg=″database″   fileName=″DepartmentJDBCSamplejava″ isNative=″false″    lineNo=″85″    method=″run2″/>   <traceEntry classFile=″DepartmentJDBCSample″   containingPkg=″database″ fileName=″DepartmentJDBCSamplejava″    isNative=″false″ lineNo=″19″ method=″main″/>  </traceInfo>

Stack Trace A describes an API that has a parameter of a query statementidentified by the prepareSQL XML element. Stack Trace A furthersidentifies the API call originating at line 19 within theDepartmentJDBCSample source file, calling line 85 within the sameDepartmentJDBCSample.java file, and finally ending within an unknownfile making a call to executeQuery.

After the correlator 130 has used source code parser 114 that parses theclient application 112 that includes Source Line A at line 85 withinsource file DepartmentJDBCSample.java, the correlator 130 searchesthrough the stack traces 182 stored in the repository 160 for matches toline 85 of file DepartmentJDBCSample.java. Upon finding the entry withinStack Trace A, the correlator 130 associates the query “SELECT DEPTNO,DEPTNAME, MGRNO, ADMRDEPT, LOCATION FROM DEPARTMENT” with the API callat line 85. By combining information gathered from source code parser114 and the stack trace 182, the correlator 130 is able to derive thequery statement issued by Source line A.

Thus, within the stack trace 182, the correlator 130 may derive that thequery issued by the API call goes through the path of source line 19 tosource line 85 and ends up at a class called StatementProxyHandler whenthe client application 112 finally issues the “executeQuery” API call.The correlator 130 further processes the query and the stack trace togenerate the dependency information after the query has been captured.This dependency information is stored in the repository 160 ascorrelator results 172. Then, a developer (or other user) may retrievethe correlator results 172 to understand how the DEPARTMENT table isbeing used by the client application 112.

The above Stack Trace A also illustrates a need to further narrow thestack trace 182 to eliminate information unrelated to the clientapplication developer, such as internal classes used by other vendorsthat the client application developer has no access to. For example, itmay be seen from the class package“com.ibm.pdq.runtime.internal.wrappers.db2” that the client applicationquery does not originate from this class. Embodiments introduce amechanism of filtering to remove noise from the stack trace 182. Bycomparing the package names with some known package names that may befiltered, the correlator 130 may reduce the noise in the stack trace.For example, by registering to the correlator 130 that package namesstarting with com.ibm are to be removed, the correlator 130 may reducethe stack trace to Stack Trace B:

Stack Trace B <traceInfo>  <traceEntry classFile=″DepartmentJDBCSample″  containingPkg=″database″   fileName=″DepartmentJDBCSamplejava″isNative=″false″ lineNo=   ″85″    method=″run2″/>  <traceEntryclassFile=″DepartmentJDBCSample″   containingPkg=″database″fileName=″DepartmentJDBCSamplejava″    isNative=″false″ lineNo=″19″method=″main″/> </traceInfo>

In certain embodiments, while the correlator 130 is able to remove some(e.g., well-known) packages from the stack trace, there are still stacktraces within the client application 112 that cannot be reduced furthersince they all share the same package. In certain embodiments, drillingdeeper into removing classes may not help with intra-class calls.

Since the API call comes from the client application 112, the stacktrace contains entries from within the client application 112. Bylooking at the stack trace information along with the API locations fromthe source code parser 114 output, embodiments extract from the stacktrace the location in the source code where the query calls takes place,eliminating all the other entries that are unrelated to the application.Thus, by intersecting the source information 180 and the stack traceinformation, the correlator 130 pinpoints the location in the sourcecode where the query call takes place. The intersection between thestack trace information and the source information 180 provides thelocations of the query calls.

In certain embodiments, the correlator 130 does not just examine theclass names with use of the stack trace to find the location because, atleast for JAVA® calls, java.sql.Connection is an interface name, and thestack trace contains information about the class that implements theinterface without providing the interface name. For example, thefollowing is Stack Trace C:

Stack Trace C traceEntry classFile=″StatementProxyHandler″ containingPkg=″com.ibm.pdq.runtime.internal.wrappers.db2″ fileName=″Unknown Source″ isNative=″false″ lineNo=″″  method=″executeQuery″/>

In Stack Trace C, the target of the executeQuery API call is a classcalled StatementProxyHandler, not java.sql.Connection. Without theinterface name in the stack trace 182, it is not possible to identifyjava.sql.Connection from the stack trace 182. By intersecting the sourceinformation 180 with the stack trace information, the correlator 130reveals the JAVA® interface of the target (StatementProxyHandler).

FIG. 2 illustrates logic performed by the correlator 130 using sourceinformation 180 and a stack trace 182 to gather data to understand howthe client application 112 accesses the database 170 in accordance withcertain embodiments. Control begins at block 200, in which thecorrelator 130 invokes the source code parser 114 to obtain sourceinformation 180, including locations of API calls in the source code ofthe client application 112 and the parameters of these API calls, wherethe parameters do not include the query text for a query that is to beused to access the database 170. Some existing client applications 112use a standard set of API calls to access the database 170. For example,many JAVA® applications use a JAVA® Database Call (JDBC®) API to accessthe database 170. After the source code parser 114 parses the clientapplication 112 and records the locations in which API calls to thedatabase 170 are used, the correlator 130 gathers the set of locationsin the client application 112 where interactions (i.e., the API calls)with the database 170 take place.

In block 202, the correlator 130 stores source information 180 in therepository 160. In certain alternative embodiments, the source codeparser 180 may store the source information 180.

In block 204, the correlator 130 examines the stack trace 182 toidentify locations of the API calls in the stack trace. The correlator130 has the locations of the API calls in the source information 180.Then, the correlator 130 examines the stack trace 182 whenever a call tothe database 170 happens. Then, by examining the stack trace 182 of theclient application 112 during the API call, the correlator 130determines information about the path the client application 112 hastaken to issue the API call. Information about the path the clientapplication 112 takes to the database provides a pointer to a locationin the client application 112 at which the API call is made and wherechanges may be made to use a different database schema 176 or databaseobjects.

In block 206, the correlator 130 derives query text of the queries(e.g., SQL statement text, such as a SELECT statement) issued by the APIcalls and the locations of the queries in the source code by identifyingthe queries in the stack trace at the locations of the API calls in thestack trace. In particular, the correlator 130 uses an intersection ofthe locations of the API calls and paths from stack trace that identifylocations of API calls to identify the queries. In block 208, thecorrelator 130 invokes the query parser 115 to parse the queries toidentify database objects. In block 210, the correlator 130 storescorrelator results 172 in the repository 160. In certain embodiments,for each API call, the correlator results 172 identify the source fileof the client application 112, source code location (i.e., line number)where the API call occurs in the source code, and parameters of the APIcall, where one of the parameters is the query text. The correlatorresults 172 may also include the database objects 186 which the querymakes use of. In block 212, analysis may be performed on the correlatorresults 172 by, for example, the analyzer 150. In certain embodiments,the analysis of block 212 includes retrieving the correlator results 172and providing user interface views to allow analysis of the correlatorresults 172.

In certain embodiments, the correlator 130 generates correlator results172 by running the client application 112 through the debugger 140. Whenthe client application 112 is run in the debugger 140, the debugger 140retrieves the stack trace information for each API call. The debuggerexamines the stack trace 182 prior to the API call to the database 170to gather information about the client applications 112 for furtheranalysis. The information gathered includes the call stack, parametersused in the API call, and the source file and line number of the APIcall.

With the debugger 140, source code stack information is revealed onevery API call. The debugger 140 sets breakpoints in the source codebased on the source information 180 to stop on every API call to thedatabase 170 to take the stack trace information. The debugger 140gathers correlator results 172 (i.e., information) similar to theinformation generated by intersecting the source information and thestack trace information.

Consider the API call in Source Line A (which is repeated here for easeof reference):

Source Line A

-   -   ResultSet resultSet=statement.executeQuery(“SELECT ”+getColumns(        )+getTable( );

When the debugger 140 stops at a breakpoint corresponding to the APIcall in Source Line A, the stack trace 182 does not reveal enoughinformation about the actual query being issued because the constructionof the query has not begun yet. In this example, multiple function calls(e.g., getColumns( ) getTable( ) and the concatenation of the strings)have to happen before the API call to executeQuery is made. Withembodiments, the debugger 140 does those calls and stops right beforethe call to executeQuery and then generates a stack trace (i.e., takes asnapshot of the stack).

Embodiments introduce a rule based debugger guidance system to guide thedebugger 140 to perform the calls, stop before the call to executeQuery,and take the snapshot. Since a developer knows what the stack shouldlook like when the API call takes place, the developer may establish thedebugger rules 190 for the debugger 140. The debugger 140 uses thedebugger rules 190 to identify when to stop when conditions in thedebugger rules 190 are met. In certain embodiments, many API calls todatabase 170 are standardized, and the debugger rules 190 for the APIcalls may be pre-programmed into the debugger 140, saving developers theneed to define the debugger rules 190.

In certain embodiments, different types of API calls are associated withdifferent sets of rules. An infrastructure is set up by the debugger 140to decide which set of rules (or sets of rules) to follow depending onthe type of API call in the breakpoint. This allows the debugger 140 totraverse any kind of API call and stop at the desirable location throughmatching of the stack frame instead of relying on source line numbers.

For example, to find the call before the executeQuery API call, it isknown:

-   -   i. The API call is called executeQuery.    -   ii. The target class implements the java.sql.Connection        interface    -   iii. There should be two variables on the stack (first one is        the target object, second one should be a string)

By setting these rules, the developer can direct the debugger 140 tostep into and return to the breakpoint until the rules are satisfied.When the rules are satisfied, the debugger 140 knows it is stoppingright before the actual call to executeQuery is to take place and mayrecord the stack information.

Examples of debugger rules 190 are provided merely to enhanceunderstanding of the embodiments. The following is example Debugger Rule1:

Debugger Rule 1

-   -   A JAVA® class that implements the JAVA® interface        java.sql.Connection, and executing an API call named        prepareStatement, and    -   the API call being executed has one parameter, and    -   the parameter is of type java.lang.String.

The correlator 130 finds that the Debugger Rule 1 rule is met if thedebugger 140 is about to execute the query statement listed in Code A:

Code A

-   -   stmt=connection.prepareStatement(“SELECT FIRSTNME, LASTNAME from        EMPLOYEE”);

The following is example Debugger Rule 2:

Debugger Rule 2

-   -   A JAVA class that implements the Java interface        java.sql.Statement, and    -   executing an API call named executeQuery, and    -   the API call being executed has one parameter, and    -   the parameter is of type java.lang.String

Debugger Rule 2 may be used for Source Line A:

Source Line A

-   -   ResultSet resultSet=statement.executeQuery(“SELECT ”+getColumns(        )+getTable( );

For Source Line A, the correlator 130 guides the debugger 140 to pause,step through the code to call getColumns( ) and getTable( ) (since atthat point the parameter type is not java.lang.String yet) until boththe getColumns( ) and getTable( ) functions are called and the resultconcatenated with the “SELECT” string to form the actual string thatmatches the java.lang.String type. Then the correlator 130 pauses tomake a copy of the stack trace and retrieves the parameter.

Embodiments also enhance conditional breakpoints. The debugger 140 mayrely on setting the breakpoint based on the source information 180(e.g., line numbers). In certain embodiments, the debugger 140 allowsthe use of conditional breakpoints that may be attached to thebreakpoints that are based on the source information 180. Somedevelopers (especially developers not familiar with the clientapplication 112) find it difficult to determine where to set thesebreakpoints.

By automatically locating the locations in which breakpoints may be setusing the source information 180 and by attaching rules to thesebreakpoints, embodiments allow users to set breakpoints based on thequery text that they wish to stop at. For example, the following isQuery A (which is repeated here for ease of reference):

Query A

-   -   SELECT FIRSTNME, LASTNAME from EMPLOYEE        Beyond the standardized set of debugger rules 190, a developer        can also direct the debugger 140 to stop whenever a particular        query is encountered (e.g., whenever the particular query is        issued from the client application 112). In certain embodiments,        the user may establish the rule with a User Interface (UI)        gesture or by inputting text that describes the rule. This        simplifies the task of setting breakpoints and attaching        conditions to the breakpoints. Also, this avoids the developer        either missing some areas of the client application 112 or        mistyping queries. In particular, with traditional debuggers,        the developer manually specifies where the breakpoints are. On        the other hand, with the debugger 140, the developer may specify        the debugger rules 190 (e.g., “Just stop whenever you see this        query”) without having to go through the source code and putting        down breakpoints. With embodiments, the developer may specify        the debugger rules 190 (e.g., using a UI), and the developer        avoids manually typing the queries into the debugger 140.        Because the debugger 140 has access to the client application        112, the debugger 140 may even stop on a query such as the        following Query B by examining the query text and the two        parameters being passed in to execute Query B.

Query B

-   -   INSERT INTO EMPLOYEE (FIRSTNME, LASTNAME) values (?, ?)

FIG. 3 illustrates logic performed by the correlator 130 using adebugger 140 to gather data to understand how the client application 112accesses the database 170 in accordance with certain alternativeembodiments. Control begins at block 300, with the correlator 130setting breakpoints based on the source information 180 to stop on everyAPI call to the database 170. In certain embodiments, the correlator 130obtains the locations of the API calls in the source code from thesource information 180 and sets breakpoints at the API calls. In certainalternative embodiments, a developer may set the breakpoints. In block302, the correlator 130 runs (i.e., executes) the client application 112through the debugger 140. In block 304, the correlator 130 determineswhether a breakpoint has been reached. If so, processing continues toblock 306, otherwise, processing continues to block 318.

In block 306, the correlator 130 identifies one or more debugger rules190. In block 308, the correlator 130 determines whether the conditionsof the one or more debugger rules 190 have been satisfied. If so,processing continues to block 310, otherwise, processing continues toblock 318. In block 310, once the one or more debugger rules 190 aresatisfied, the correlator 130 obtains a stack trace just before a APIcall to the database 170. In block 312, the correlator 130 derives querytext of the query (e.g., SQL statement text, such as a SELECT statement)that is issued against the database 170 and locations of the query inthe source code. In block 314, the correlator 130 invokes the queryparser 115 to parse the query to identify database objects. In block316, the correlator 130 stores correlator results 172 that includeinformation from the stack trace. In certain embodiments, for each APIcall, the correlator results 172 identify the source file of the clientapplication 112, source code location (i.e., line number) where the APIcall occurs, and parameters, where one of the parameters is the querytext. The correlator results 172 may also include the database objects186 which the query makes use of From block 316, processing continues toblock 318.

In block 318, the debugger 140 continues running the client application112 until either a breakpoint is reached, in which case processingcontinues to block 304, or the client application 112 execution iscomplete.

The correlator results 172 gathered by the correlator 130 and debugger140 are stored in the repository 160 and be used later on for monitoringand problem determination.

Thus, embodiments provide the correlator 130 and the debugger 140 toassociate queries with lines of the source code. Such an association maybe used to determine the interaction between the client application 112and the underlying database 170. When the underlying database schema 176needs to be changed, a developer may quickly use this information todetermine how much each client application 112 needs to be changed andthe extent of the impact.

Using the searchable index 116, the correlator 130 may locate places inthe client application 112 where an interaction with the database 170takes place. In certain embodiments, by installing a listener on theJDBC® interaction between the client application 112 and the database170, the correlator 130 obtains stack information during the query calland determines possible locations within the source code where the APIcalls take place. By using the searchable index 116, the correlator 130singles out the location from the stack trace where the most relevantsource location is for a particular API call.

When running the client application 112 through the debugger 140, adeveloper is able to provide debugger rules 174 for the debugger 140 toguide the debugger 140 through stepping through the source code,providing precise information about the location of the API call and thecall parameters.

The correlator 130 and debugger 140 contribute to enhancingunderstanding of the client application 112 without having to rely onmanual techniques of documentation.

In certain embodiments, the correlator results 172 are stored in arelational form (for ease of query) and are used when a problem occurs.Thus, given a query, embodiments locate the client application 112 thatgenerates this query by searching the repository 160.

The correlator 130 and debugger 140 work on existing client applications112 without requiring any changes to the client applications 112.Developers may use tools that implement these embodiments for existingclient applications 112. The correlator results 172 also reflect thecurrent state of the client applications 112, not any manually writtenapplication model or documentation that could be already be outdated byrecent undocumented changes. This gives developers accurate knowledgeabout client applications 112 and enables developers to be confident inmaking changes to the source code as business needs evolve and databaseobjects 186 change.

Embodiments also provide the analyzer 150 and UI generator 118. Theanalyzer 150 may be applied to any client application 112 (e.g., a JAVA®database application, using plain JDBC® or a framework, hence thebenefits are available to the JAVA® database application developer andDBA community). Certain examples of embodiments of the analyzer 150focus on client applications 112 that use the JAVA® programminglanguage, but embodiments apply to any programming language (includingprocedural programming languages).

Embodiments connect the ability to gain insight into the queries in aclient application 112, the source code location of the queries, and thedatabase objects 186 that are used by the queries. The analyzer 150performs a combination of complex analysis to connect this informationin a meaningful way that may answer the following Set of Questions:

Set of Questions

-   -   1. Where are the one or more queries located in the source code?    -   2. What are the one or more queries issued by a certain JAVA®        class?    -   3. For each query, what are the database schema 176 and database        objects 186 (e.g., tables and columns) that the query uses?    -   4. For each database schema 176 or table used by the client        application 112, what are the one or more queries issued by the        client application 112?    -   5. Does the query execute producing the results as expected?    -   6. How does the query perform?    -   7. What are the one or more queries issued by the client        application 112?

Typically, deep knowledge of JAVA® client applications and databases isneeded to provide such information integrated within a development tool.To make this information available within the development environment,embodiments collect the information before the client application 112has gone into production (e.g., at development time), as opposed todependency on stack traces created after client application 112execution.

FIG. 4 illustrates logic performed by the analyzer 150 and UI generator118 in accordance with certain embodiments. Control begins at block 400with the analyzer 150 analyzing the client application 112 to identifyqueries and the locations of the queries in the client application 112.

The analyzer 150 performs complex analysis using JAVA® models (whichrepresent the JAVA® application), query models (which represent thequery (e.g., a parse tree), source code parser 114, query parser 115,database models, XML parsers, Web Services Description Language parsersto scrub information from artifacts such as JAVA® client applications,web services, and routines (e.g., procedures and User Defined Functions(UDFs)). Not only is the source code analyzed for any queries that arehardcoded, the source code is also combined with dynamic analysisinformation collected by running the application to ensure that queriesthat are constructed at execution time are collected as well.

In certain embodiments, the analyzer 150 performs complex analysis tocombine the results of source information 180 from static analysis(i.e., without running the client application 112) and intersects thesource information 180 with the stack trace 182 produced by the dynamicanalysis to provide further accuracy in the source code location foreach query.

In block 402, the analyzer 150 identifies database objects 186 used bythe queries. In certain embodiments, each query collected is analyzedwith the query model and the query parser 115 to identify which databaseobjects 186 the query uses.

In block 404, the analyzer 150 stores the collective information asanalyzer results 178 in the repository 169.

In block 406, the UI generator 118 in the development environment 110generates user interface views (further described with reference toFIGS. 5-13) using the analyzer results 178 to allow analysis of theanalyzer results 178. That is, the UI generator 118 presents informationto a user in UI views to enable the Set of Questions (listed above), aswell as other questions, to be answered in a productive, intuitive, andusable way.

In certain alternative embodiments, the analyzer 150 retrieves thecorrelator results 172, and the UI generator 118 generates userinterface views (further described with reference to FIGS. 5-13) usingthe correlator results 172 to allow analysis of the correlator results172. Embodiments provide integrated tools (e.g., the correlator 130, thedebugger 140, the analyzer 178, and the UI generator 118) that providethe analyzer results 178 within the development environment 110 tofurther reduce the gap while developing queries in the JAVA® applicationwithin the JAVA® development environment 110 reduce gap while developingqueries in the JAVA® programming language within the JAVA® environment.

The integrated tools add value not only to developers who gain insightinto the database objects 186 used by the queries, but also to DBAs andother roles outside of development, to gain knowledge about where thequeries (which are potentially performing badly as reported by databaseperformance tools) are located in the source code. Embodiments provideadvanced integration between the queries and the JAVA® application thatwill benefit problem determination of poorly performing queries.

Embodiments focus on the use of various techniques (i.e., staticanalysis, source code indexing (creating the searchable index 116),dynamic analysis, and instrumentation), sometimes in combination, toassist developers in problem determination and where used analysis,leading to higher productivity for developers.

Static analysis allows developers to understand source code withouthaving to run the client application. For example, with dataflowanalysis, developers may understand the relationship between variabledeclarations and usages. The developers may also make guesses toexpressions that could be generated by drilling deeper on how theexpressions may be formed. Such static analysis helps examine clientapplications.

As to source code indexing, it is customary to index source code to makeit easy for developers to find their way around large number of sourcefiles. For instance, the source code parser 114 enables developers tofind JAVA® classes and API calls within their workspace. Workspace maybe described as a place where client applications 112 are located in thedevelopment environment 110. These types of analysis may be used tolocate queries in client applications 112.

As to dynamic analysis, such as the JAVA® programming language, it ispossible to perform introspection of the client application 112 whilethe client application 112 is running Introspection may be described asobtaining the stack trace 182 from the client application 112 as theclient application 112 is running There are also tools, such asdebugging API tools (e.g., debugger 140), which help developers debug atthe source level.

Traditional instrumentation often requires changes to the source code.The JAVA® programming language has made it easier to do byte codeinstrumentation. Byte code instrumentation is a technique that allowsmodifying the client application 112 while the client application 112 isrunning, without requiring changes to the source code. This, forexample, allows pure JAVA® profilers to profile source code bydynamically inserting calls to the profiler on routines duringapplication loads. A profiler may be described as allowing tuning toobtain performance data from the client application 112.

To answer the first question in the Set of Questions (“Where are the oneor more queries located in the source code?”), the analyzer 150 employsmultiple strategies to extract the queries within the client application112 since no single technique works best for the different ways in whichthe client application 112 may make use of the queries. The firststrategy is to employ static analysis. Given a language, such as theJAVA® programming language, the analyzer 150 leverages the JAVA® modelto shallow parse the source code to build up a list of API calls. Ashallow parse may be described as a process for extracting enoughinformation from the source code to obtain the API call and theparameters of the API call (without trying to understand therelationship between variables, call chains, etc., in this stage). Incertain embodiments, the analyzer 150 invokes the source code parser 114to do this. Whether the client application 112 is a JDBC® application oris using frameworks, such as JPA or Hibernate, there are standard APIcalls (e.g., the API calls in Set A above) that the client application112 will use to issue queries. Using source code indexing, the analyzer150 searches amongst the source code for the standard API calls. Forexample, the analyzer 150 searches for the locations where aprepareStatement call is made on a Connection. Once the source locationthat issues one of these interfaces is located, the analyzer 150 usesstatic analysis to analyze the source code. For example, the followingis a JAVA® Code Fragment:

JAVA® Code Fragment

-   -   Connection connection=connection.createStatement( );    -   PreparedStatement pstatement=connection.prepareStatement(“select        name from dept”);

Given the JAVA® Code Fragment located using this static analysis, theanalyzer 150 extracts (e.g., by invoking the source code parser 114) thequery text directly from the argument list of the JAVA® Code Fragment.Deeper analysis may be performed for more complex expressions. Forexample, the following is Statement A:

Statement A

-   -   String s=“select name from dept”;    -   PreparedStatement pStatement=connection.prepareStatement(s);

For statement A, the analyzer 150 performs data flow analysis tocorrelate the query to the string defined in a statement before. In comecases, static analysis may work for more complex expressions such asStatement B:

Statement B

-   -   PreparedStatement        pStatement=connection.prepareStatement(getSql(x))

Sometimes the query is not determined by static analysis alone. Forexample, queries that are read from files or constructed dynamicallythrough complex logic may be easier to intercept at run time. In suchcases, dynamic analysis instrumentation may be used. For example, theanalyzer 150 intercepts the query through multiple means:

-   -   i. One means is using an execution stack trace. By using a        wrapped connection object, the analyzer 150 intercepts the query        when a query call is being made. This allows examination of the        stack trace at the point the query is issued to connect the        query with the sources responsible for issuing the query.    -   ii. Another means is through the use of a debugger 140. When        using the debugger 140 to walk through the source code, the        debugger 140 sets break points at which the query call is being        made. These locations may be found by searching the source code        for well known query API calls. After the breakpoint is reached,        the debugger 140 examines the call stack for the location of the        source as well the as the query as a parameter to the API call.    -   iii. Yet another means is through the use of instrumentation.        Similar to use of the debugger 140, embodiments add additional        source code during application load time to instrument the        source code being executed. By inserting the source code around        the query execution points, embodiments extract the query being        executed and also record the source information linking the        query to the source executing the query.

In certain embodiments, dynamic analysis does not change source code forthe analysis.

With both static and dynamic analysis, embodiments gain insight into therelationship between the source code and the query. Embodiments composea user interface (UI, also referred to as a Graphical User Interface(GUI)) linking the query with the source code, if the source code isavailable. The information is precise enough to link to the source fileand the correct line number at which the query is located. For example,double-clicking or using menus from each query point takes the user tothe line of source code. If the source code is not available, dynamicanalysis results pointed to the .class file information. When usingframeworks that use object query languages in the client application112, but that depend on the framework to create the query at executiontime, the line of source code triggering the generation of the query isshown. For example, in a JPA case, the query generated by the commit APIcall points back to the commit( ) in the source code.

FIGS. 5A, 5B, 5C, and 5D illustrate a user interface view 500 showinglinking to a query when using JDBC® in accordance with certainembodiments. FIGS. 5A, 5B, 5C, and 5D may be described as providinginformation in response to the first question in the Set of Questions(“Where are the one or more queries located in the source code?”). Inuser interface view 500, database tab 510 (FIG. 5C) has been selected bya user, and database schemas and database objects are shown. Also, a“Show in Source” menu has been selected, which shows where a query(“UDPATE STAFF SET SALARY=SALARY+1000 WHERE ID>=? AND DEPT=?”) islocated in source code 520.

Embodiments allow JAVA® Persistence API Language queries (JPAQL) (i.e.,an object query language for the framework JAVA® Persistence API) insource code. JPAQL is a type of query. Queries to the database 170 aresupported whether they are in object query language (e.g., JPAQL) orstandard query language (e.g., SQL).

The static and dynamic analysis techniques work on any type of clientapplications 112, including iBATIS/Spring types of frameworks thatcontain a well defined interface in which queries are issued to thedatabase 170. By creating relationships between the client applicationsource and the resulting queries, embodiments show developers how theirclient applications 112 affect the database 170. This is educational forusers of ORM frameworks, such as JPA or Hibernate, because the frameworkhides the query from the developers.

During problem determination, when presented with queries from DBAs,application developers sometimes go back to the client application 112to locate which line causes the problem. Embodiments provide a mappingbetween the query and the source code that makes the problemdetermination task simpler.

Beyond mapping the source code and the queries, the captured queries arealso used to show the relationship between web services and queries in aweb environment. In certain embodiments, capture is done in twoplaces: 1) at the entry point of the web service and 2) at the site inwhich queries are issued. Using instrumentation, embodiments instrumenta web services call to retrieve the URL and the resulting querygenerated, providing a view between web services and the databaseactions.

To answer the second question in the Set of Questions (“What are the oneor more queries issued by a certain JAVA® class?”), further analysis isperformed on the information gathered with source code indexing. Withinformation gathered by both static and dynamic analysis, embodimentsfurther break down the information into queries used per JAVA® class.This information is available with or without source code availabilitywhen using frameworks or JDBC®.

FIG. 6 illustrates a user interface view 600 showing selection of aJAVA® tab in accordance with certain embodiments. FIG. 6 may bedescribed as providing information in response to the second question inthe Set of Questions (“What are the one or more queries issued by acertain JAVA® class?”). User interface view 600 illustrates linksbetween database objects 610, a query 620, and object query language630.

FIG. 7 illustrates a user interface view 700 showing further details ofa list of queries per JAVA® class in accordance with certainembodiments. In user interface view 700, the JAVA® tab 710 has beenselected by a user, and query statements for JAVA® classes 720 and 730are shown.

To answer the third question in the Set of Questions (“For each query,what are the database schema 176 and database objects 186 (e.g., tablesand columns) that the query uses?”), embodiments perform dependencyanalysis to enable users to understand how the database schema 176 isused by the source code. To facilitate the understanding of how eachquery is used, embodiments parse each query with the appropriate queryparser 115 for the individual databases 170. Embodiments provide theresult through the user interface.

FIG. 8 illustrates a user interface view 800 showing database schemas176 and database objects 186 that a query uses in accordance withcertain embodiments. In the user interface view 800, the JAVA® tab 810has been selected by a user.

To answer the fourth question in the Set of Questions (“For eachdatabase schema 176 or table used by the client application 112, whatare the one or more queries issued by the client application 112?”),embodiments use dependency analysis with dynamic analysis to present theuser with a view based on how the database schema 176 is accessedregardless of the client application 112. By gathering up the dependencyinformation of the queries that access an individual table or column,embodiments build up a view of how database objects 186 are used.Developers may use this view to predict the amount of changes for anupcoming database change. FIG. 9 illustrates a user interface view 900showing queries used by each database object 186 in accordance withcertain embodiments. In the user interface view 900, the database tab910 has been selected by a user.

To answer the fifth question in the Set of Questions (“Does the queryexecute producing the results as expected?”), embodiments provide toolsas part of the UI generator 118 or analyzer 150 that allow execution ofqueries. Queries with any parameters may be executed by providing thevalues in the user interface. The user may select rollback or commit foreach sample run. The user may filter out query columns to view to selecta maximum number of rows to be retrieved. Embodiments remember parametervalues across query executions. Embodiments show results in queryexecution views. Providing this extensive functionality is useful,especially in the case of frameworks where there is no visibility to thequeries from the source code. FIGS. 10A, 10B, 10C, and 10D illustrate auser interface view 1000 showing how queries may be run with a “Runquery menu” in accordance with certain embodiments. In user interfaceview 1000, a “Run SQL” menu 1010 (FIG. 10D) has been selected by a user,parameters are provided by the user through a “Specify Host VariableValues” box 1020, and data output 1030 (FIG. 10C) is shown.

To answer the sixth question in the Set of Questions (“How does thequery perform?), embodiments run query tuning tools for each query toallow the user to view the performance of the query and to enable theuser to make changes proactively at design time, thus avoiding issues inproduction. With query tuning tools for each database vendor,embodiments provide seamless integration. FIGS. 11A, 11B, 11C, and 11Dillustrate a user interface view 1100 showing the performance of a querywith a “Launch Visual Explain” menu in accordance with certainembodiments. In user interface view 1100, a “Launch Visual Explain” menu1110 has been selected by a user.

To answer the seventh question (“What are the one or more queries issuedby the client application 112?”), embodiments have knowledge in JAVA®data models and JAVA® database applications to scrub the queries fromthe client applications 112 based on JDBC or any proprietary framework.Embodiments perform analysis to get a full list of the queries and saveto metadata, which is shown in 12A, 12B, 12C, and 12D (e.g., “Export SQLto File . . . ” menu).

Embodiments have visibility into queries in the client application 112and export the queries into a query file. Exporting allows sharing thequeries with other members (such as a DBA who may then optimize thequeries proactively), which enables developing higher quality clientapplications 112, especially when using frameworks in which clientapplications 112 do not provide insight into the queries in the sourcecode but generate the queries at runtime. Thus, embodiments help problemdetermination and where used analysis. FIGS. 12A, 12B, 12C, and 12Dillustrate a user interface view 1200 for exporting data in accordancewith certain embodiments.

In terms of performance analysis, embodiments provide user interfaceviews that display the queries in the client application 112, andembodiments present developers with performance data in the context ofthe client application 112. Some database performance monitorapplications gather queries and their performance data, but have no wayto trace the queries back to the client application 112. By gatheringthe metadata about the client application 112, including the queries theclient application 112 issued and the relationship of the queries backto the client application 112, embodiments join the information with theperformance data gathered by a database monitoring application toprovide user interface view 1300. FIGS. 13A, 13B, 13C, and 13D provide auser interface view 1300 with performance information in accordance withcertain embodiments. The user interface view 1300 includes, for eachquery, an execution count 1310 (FIG. 13D) and an execution time 1320(FIG. 13D).

Thus, instead of providing just a set of queries and their performancedata, embodiments show the performance data in the context of the clientapplication 112. At a glance, the developer may locate queries that aremost expensive to run and where they are in the client application 112.If refactoring of the tables is required, the developer may assess theimpact by switching to the user interface view to see how many queriesaccess the table.

Thus, embodiments provide integrated tools to solve industry pain pointsand to provide unique value towards improving productivity for numerousroles involved in client application development such as developer, DBA,support personnel etc.

ADDITIONAL EMBODIMENT DETAILS

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that may contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that may communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as JAVA®, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present invention are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, may be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that may direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The code implementing the described operations may further beimplemented in hardware logic or circuitry (e.g., an integrated circuitchip, Programmable Gate Array (PGA), Application Specific IntegratedCircuit (ASIC), etc.

FIG. 14 illustrates a system architecture 1400 that may be used inaccordance with certain embodiments. Computer 100 may implement systemarchitecture 1400. The system architecture 1400 is suitable for storingand/or executing program code and includes at least one processor 1402coupled directly or indirectly to memory elements 1404 through a systembus 1420. The memory elements 1404 may include local memory employedduring actual execution of the program code, bulk storage, and cachememories which provide temporary storage of at least some program codein order to reduce the number of times code must be retrieved from bulkstorage during execution. The memory elements 1404 include an operatingsystem 1405 and one or more computer programs 1406.

Input/Output (I/O) devices 1412, 1414 (including but not limited tokeyboards, displays, pointing devices, etc.) may be coupled to thesystem either directly or through intervening I/O controllers 1410.

Network adapters 1408 may also be coupled to the system to enable thedata processing system to become coupled to other data processingsystems or remote printers or storage devices through interveningprivate or public networks. Modems, cable modem and Ethernet cards arejust a few of the currently available types of network adapters 1408.

The system architecture 1400 may be coupled to storage 1416 (e.g., anon-volatile storage area, such as magnetic disk drives, optical diskdrives, a tape drive, etc.). The storage 1416 may comprise an internalstorage device or an attached or network accessible storage. Computerprograms 1406 in storage 1416 may be loaded into the memory elements1404 and executed by a processor 1402 in a manner known in the art.

The system architecture 1400 may include fewer components thanillustrated, additional components not illustrated herein, or somecombination of the components illustrated and additional components. Thesystem architecture 1400 may comprise any computing device known in theart, such as a mainframe, server, personal computer, workstation,laptop, handheld computer, telephony device, network appliance,virtualization device, storage controller, etc.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, may be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The foregoing description of embodiments of the invention has beenpresented for the purposes of illustration and description. It is notintended to be exhaustive or to limit the embodiments to the preciseform disclosed. Many modifications and variations are possible in lightof the above teaching. It is intended that the scope of the embodimentsbe limited not by this detailed description, but rather by the claimsappended hereto. The above specification, examples and data provide acomplete description of the manufacture and use of the composition ofthe embodiments. Since many embodiments may be made without departingfrom the spirit and scope of the embodiments, the embodiments reside inthe claims hereinafter appended or any subsequently-filed claims, andtheir equivalents.

The invention claimed is:
 1. A method, comprising: setting, with aprocessor executing on a computer, one or more breakpoints in sourcecode of a client application based on locations of ApplicationProgramming Interface (API) calls in the source code; while running theclient application through a debugger, upon reaching each of the one ormore breakpoints, identifying one or more debugger rules associated witha query at a breakpoint; in response to determining that conditions ofthe one or more debugger rules are satisfied, obtaining a stack tracebefore the query makes a call to a database; deriving query text of thequery and a location of the query in the source code of the clientapplication; parsing the query text to identify database objects used bythe query; and storing correlator results for the query that identify asource file of the client application, locations of an API call in thesource code, parameters of the API call, and the database objects,wherein one of the parameters is the query text of the query; anddisplaying user interface views in a user interface to present thecorrelator results for problem determination and where used analysis. 2.The method of claim 1, further comprising: in response to determiningthat conditions of the one or more debugger rules are not satisfied,continuing to run the client application through the debugger untilanother breakpoint is reached or execution of the client application iscompleted.
 3. The method of claim 1, further comprising: in response toderiving the query of the API call, obtaining the query text of thequery; invoking a query parser to parse the query to identify one ormore tables and one or more columns used by the query; and performinganalysis using the correlator results.
 4. The method of claim 3, furthercomprising: retrieving the correlator results; and generating the userinterface views using the correlator results, wherein the user interfaceviews provide at least one of: a view showing the query in the databaseand the query in the source code, a view showing database schemas anddatabase objects that the query uses, a view showing queries per class,a view showing the queries used by each database object in the database,a view showing how the queries are run, a view for exporting data, and aview showing performance information of execution count and executiontime for each of the queries.
 5. A computer program product comprising acomputer readable storage medium storing computer readable program codethat, when executed on a processor of a computer, causes the computerto: set, with a processor executing on a computer, one or morebreakpoints in source code of a client application based on locations ofApplication Programming Interface (API) calls in the source code; whilerunning the client application through a debugger, upon reaching each ofthe one or more breakpoints, identify one or more debugger rulesassociated with a query at a breakpoint; in response to determining thatconditions of the one or more debugger rules are satisfied, obtain astack trace before the query makes a call to a database; derive querytext of the query and a location of the query in the source code of theclient application; parsing the query text to identify database objectsused by the query; and storing correlator results for the query thatidentify a source file of the client application, locations of an APIcall in the source code, parameters of the API call, and the databaseobjects, wherein one of the parameters is the query text of the query;and displaying user interface views in a user interface to present thecorrelator results for problem determination and where used analysis. 6.The computer program product of claim 5, wherein the computer readableprogram code, when executed on a processor of a computer, causes thecomputer to: in response to determining that conditions of the one ormore debugger rules are not satisfied, continue to run the clientapplication through the debugger until another breakpoint is reached orexecution of the client application is completed.
 7. The computerprogram product of claim 5, wherein the computer readable program code,when executed on a processor of a computer, causes the computer to: inresponse to deriving the query of the API call, obtain the query text ofthe query; invoke a query parser to parse the query to identify one ormore tables and one or more columns used by the query; and performanalysis using the correlator results.
 8. The computer program productof claim 7, wherein the computer readable program code, when executed ona processor of a computer, causes the computer to: retrieve thecorrelator results; and generate the user interface views using thecorrelator results, wherein the user interface views provide at leastone of: a view showing the query in the database and the query in thesource code, a view showing database schemas and database objects thatthe query uses, a view showing queries per class, a view showing thequeries used by each database object in the database, a view showing howthe queries are run, a view for exporting data, and a view showingperformance information of execution count and execution time for eachof the queries.
 9. A system, comprising: a processor; memory; andcircuitry to perform operations, the operations comprising: setting,with a processor executing on a computer, one or more breakpoints insource code of a client application based on locations of ApplicationProgramming Interface (API) calls in the source code; while running theclient application through a debugger, upon reaching each of the one ormore breakpoints, identifying one or more debugger rules associated witha query at a breakpoint; in response to determining that conditions ofthe one or more debugger rules are satisfied, obtaining a stack tracebefore the query makes a call to a database; deriving query text of thequery and a location of the query in the source code of the clientapplication; parsing the query text to identify database objects used bythe query; and storing correlator results for the query that identify asource file of the client application, locations of an API call in thesource code, parameters of the API call, and the database objects,wherein one of the parameters is the query text of the query; anddisplaying user interface views in a user interface to present thecorrelator results for problem determination and where used analysis.10. The system of claim 9, wherein the operations further comprise: inresponse to determining that conditions of the one or more debuggerrules are not satisfied, continuing to run the client applicationthrough the debugger until another breakpoint is reached or execution ofthe client application is completed.
 11. The system of claim 9, whereinthe operations further comprise: in response to deriving the query ofthe API call, obtaining the query text of the query; invoking a queryparser to parse the query to identify one or more tables and one or morecolumns used by the query; and performing analysis using the correlatorresults.
 12. The system of claim 11, wherein the operations furthercomprise: retrieving the correlator results; and generating the userinterface views using the correlator results, wherein the user interfaceviews provide at least one of: a view showing the query in the databaseand the query in the source code, a view showing database schemas anddatabase objects that the query uses, a view showing queries per class,a view showing the queries used by each database object in the database,a view showing how the queries are run, a view for exporting data, and aview showing performance information of execution count and executiontime for each of the queries.